package com.ruoyi.wechat.api;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.wechat.domain.FacilityType;
import com.ruoyi.wechat.service.IFacilityService;
import com.ruoyi.wechat.service.IFacilityTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/wechatt/facility")
public class WxFacilityController extends BaseController {
    @Autowired
    private IFacilityService facilityService;
    @Autowired
    private IFacilityTypeService facilityTypeService;
    //    查询所有启动的服务设施类型以及对应的服务设施
    @GetMapping("/list")
    public AjaxResult list(){
        List<FacilityType> list=facilityService.facilityTypeList();
        return success(list);
    }
//    根据营地Id查询该营地下所有服务设施列表
    @GetMapping("/getInfo/{campId}")
    public AjaxResult getInfo(@PathVariable("campId") String campId)
    {
        if(campId==null){
            return  error("营地Id不能为空");
        }
        List<FacilityType> list=facilityService.campFacilityListByCampId(campId);
        return success(list);
    }
}
